<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>内训详情</title>
    <link rel="icon" href="favicon.ico" type="images/ico">
    <meta name="author" content="dc">
    <link rel="stylesheet" type="text/css" href="/css/materialdesignicons.min.css">
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/css/style.min.css">
    <link href="/js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/js/jquery-confirm/jquery-confirm.min.css"/>
    <link rel="stylesheet" href="/css/bootstrapValidator.min.css" />
    <!--时间选择插件-->
    <link rel="stylesheet" href="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css"/>
    <!--日期选择插件-->
    <link rel="stylesheet" href="/js/bootstrap-datepicker/bootstrap-datepicker3.min.css"/>
    <link rel="stylesheet" href="/css/skin.css"/>
    <link rel="stylesheet" type="text/css" href="/css/daterangepicker.css" />
    <!-- 多选下拉 -->
    <link rel="stylesheet" href="/css/bootstrap-multiselect.css" type="text/css"/>
    <link rel="stylesheet" href="/css/bootstrap-select.css" type="text/css"/>
    <link rel="stylesheet" href="/css/customerManager/customerDetail.css"/>
    <script th:inline="javascript">
        var training = [[${training}]];
    </script>
    <style>
        .customer-info ul.general li::after{
            display: none;
        }
        .general  li{
            width: 15%;
        }
        .general  li:nth-child(1){
            width: 25%;
        }
        .tooltip{
            word-break: break-all !important;
        }
    </style>
</head>
<body>
<div class="container-fluid">
    <div class="card customer-card">
        <div class="card-header">
            <h1>内训详情</h1>
            <div class="card-actions pull-right">
<!--                data-toggle="modal" data-target="#editInfoModal"-->
                <button class="btn btn-link" id="editInfo">编辑 <i class="mdi mdi-tune"></i></button>
            </div>
        </div>
        <div class="card-body" id="infoCard" style="height: 143px">
            <div id="info">
                <div class="customer-logo">
                    <div id="imageId0" class="hidden" th:text="${training?.uploadId}"></div>
                    <div class="logo">
                        <img id="newsPic0" th:src="@{(${training?.accessUrl})}"/>
                    </div>
                </div>
                <div class="customer-info">
                    <div class="title">
                        <h3 th:text="${training?.customerName}"></h3>
<!--                        <div class="code">-->
<!--                            <a href="#!"><i class="mdi mdi-qrcode"></i></a>-->
<!--                            <div class="code-box"><img src="" alt=""></div>-->
<!--                        </div>-->
                        <!-- 判断是否有到期时间字段内容 -->
                        <span class="vip" th:if="${membershipExpirationTm} eq null">VIP <strong th:text="${customer?.membershipLevel}"></strong></span>
                        <span class="vip" th:if="${membershipExpirationTm} ne null" data-toggle="tooltip" data-placement="top" th:data-original-title="'会员到期时间：' + ${membershipExpirationTm}">VIP <strong th:text="${customer?.membershipLevel}"></strong></span>
                        <div class="credit">（客户编码：<span th:text="${training?.customerNumber}"></span>）</div>
                    </div>
                    <ul class="general" style="margin-top: 40px;">
<!--                        data-toggle="tooltip" data-placement="top" data-original-title="公司规模"-->
                        <li>
                            <span>内训所有人：</span><span  th:text="${training?.userName}" ></span>
                        </li>
                        <li>
                            <span>提供时间：</span><span  th:text="${createTm}" ></span>
                        </li>
                        <li>
                            <span>返点设置：</span><span  th:text="${training?.rebateSetting}" ></span>
                        </li>
                        <li>
                            <span>目前返点金额：</span><span  th:text="${training?.currentRebateAmount}" ></span>
                        </li>
                        <li>
                            <span>当前状态：</span><span  th:text="${currentState}" ></span>
                        </li>
                    </ul>
                    <div class="tags clearfix" id="tagsBox"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="card">
        <input type="hidden" id="hrefType" name="hrefType" th:value="${hrefType}"/>
        <ul class="nav nav-tabs tabs-lg" role="tablist">
            <li class="active" onclick="companyInformationc('0')"><a href="#companyInformation" aria-controls="" role="tab" data-toggle="tab" aria-expanded="true">内训需求表</a></li>
            <li class="" onclick="contactListc()"><a href="#contactList" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">联系人</a></li>
            <li class="" onclick="productc()"><a href="#product" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">沟通记录</a></li>
            <li class="" onclick="contractc()"><a href="#contract" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">教务需求</a></li>
            <li class="" onclick="trainingContractAndOrderTableInit()"><a href="#contractAndOrderList" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">合同订单</a></li>
            <li class="" onclick="followUpRecordc()"><a href="#followUpRecord" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">回款管理（发票）</a></li>
            <li class="" onclick="visitRecordc()"><a href="#visitRecord" aria-controls="" role="tab" data-toggle="tab" aria-expanded="false">项目实施（风险）</a></li>
        </ul>
        <div class="tab-content">
            <!-- 内训需求表 -->
            <div role="tabpanel" id="companyInformation" class="tab-pane active">
                <span id="trainingId" class="hidden" th:text="${training?.trainingId}"></span>
                <span id="trainingDemandId" class="hidden"></span>
                <div class="row company-info">
                    <div class="col-xs-12">
                        <button class="btn btn-link pull-right" id="editTrainingDemand" onclick="addTrainingDemand(1)" style="display: none">编辑 <i class="mdi mdi-tune"></i></button>
                        <button class="btn btn-link pull-right" id="addTrainingDemand" onclick="addTrainingDemand(0)"  style="display: none">新增 <i class="mdi mdi-tune"></i></button>
                    </div>
                    <div class="col-xs-6">
                        <div class="well">
                            <img src="/images/company-info-3.png" alt="">
                            <p>公司规模：<span id="company_size"></span></p>
                            <p>需求负责人：<span id="demandLeader"></span></p>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="well">
                            <img src="/images/company-info-1.png" alt="">
                            <p>公司财务人数：<span id="companyFinancialNumber"></span></p>
                            <p>需求负责人联系方式：<span id="contactDetails"></span></p>
                        </div>
                    </div>
                </div>
                <div class="well form-well">

                    <h3>需求向列表<button class="btn btn-link btn-sm" data-toggle="modal" id="newRequirement" onclick="newRequirement();">增加需求 <i class="mdi mdi-tune"></i></button></h3>
                    <table id="trainingList" class="company-profile"></table>
                </div>
            </div>
            <!-- 联系人名录 -->
            <div role="tabpanel" id="contactList" class="tab-pane">
                <p>
                    <button type="button" class="btn btn-success btn-label" onclick="addTrainingContact()">
                        <label><i class="mdi mdi-plus"></i></label>新增联系人</button>
                </p>
                <table id="contactListDetail"></table>
            </div>
            <!-- 产品明细 -->
            <div role="tabpanel" id="product" class="tab-pane">
<!--                <div class="well form-well">-->
<!--                    <h3>会员产品</h3>-->
<!--                    <table id="memberFinishOrderProductDetail"></table>-->
<!--                </div>-->
<!--                <div class="well form-well">-->
<!--                    <h3>非会员产品</h3>-->
<!--                    <table id="nonMemberFinishOrderProductDetail"></table>-->
<!--                </div>-->
<!--                <div class="well form-well">-->
<!--                    <h3>兑换产品</h3>-->
<!--                    <table id="redeemProductsTableDetail"></table>-->
<!--                </div>-->
            </div>
            <!-- 合同 -->
            <div role="tabpanel" id="contract" class="tab-pane">
<!--                <div class="clearfix m-b-10 info-box">-->
<!--                    <button type="button" class="btn btn-success btn-label" onclick="addContract();"><label><i class="mdi mdi-plus"></i></label>创建合同</button>-->
<!--                    <div class="pull-right">-->
<!--                        <div class="pull-left">账户余额：<span th:text="${customer?.customerWallet ?: '0'}"></span></div>-->
<!--                        <div class="pull-left">转入额：<span th:text="${customer?.customerShiftWallet ?: '0'}"></span></div>-->
<!--                    </div>-->
<!--                </div>-->
<!--                <table id="contractDetail"></table>-->
            </div>
            <!-- 合同订单 -->
            <div role="tabpanel" id="contractAndOrderList" class="tab-pane">
                <table id="trainingContractAndOrderTable"></table>
            </div>
            <!-- 兑换 -->
            <div role="tabpanel" id="exchange" class="tab-pane">
<!--                <p>-->
<!--                    <button type="button" class="btn btn-success btn-label"-->
<!--                            onclick="addExchange()"><label><i class="mdi mdi-plus"></i></label>新增兑换-->
<!--                    </button>-->
<!--                </p>-->
<!--                <table id="exchangeDetail"></table>-->
            </div>
            <!-- 跟进记录 -->
            <div role="tabpanel" id="followUpRecord" class="tab-pane">
<!--                <table id="followUpRecordDetail"></table>-->
            </div>
            <!-- 拜访记录 -->
            <div role="tabpanel" id="visitRecord" class="tab-pane">
<!--                <table id="visitRecordDetail"></table>-->
            </div>
            <!-- 需求分析 -->
            <div role="tabpanel" id="demandAnalysisList" class="tab-pane">
<!--                <p>-->
<!--                    <button type="button" class="btn btn-success btn-label"-->
<!--                            onclick="addDemandAnalysis()"><label><i class="mdi mdi-plus"></i></label>新增需求分析-->
<!--                    </button>-->
<!--                </p>-->
<!--                <table id="demandAnalysisListDetail"></table>-->
            </div>
            <!-- 竞品列表 -->
            <div role="tabpanel" id="competitorList" class="tab-pane">
<!--                <p>-->
<!--                    <button type="button" class="btn btn-success btn-label"-->
<!--                            onclick="addCompetitor()"><label><i class="mdi mdi-plus"></i></label>新增竞品-->
<!--                    </button>-->
<!--                </p>-->
<!--                <table id="competitorListDetail"></table>-->
            </div>
            <!-- 商机列表 -->
            <div role="tabpanel" id="opportunityList" class="tab-pane">
<!--                <p>-->
<!--                    <button type="button" class="btn btn-success btn-label"-->
<!--                            onclick="addOpportunity()"><label><i class="mdi mdi-plus"></i></label>新增商机-->
<!--                    </button>-->
<!--                </p>-->
<!--                <table id="opportunityListDetail"></table>-->
            </div>
        </div>
    </div>
</div>
<!-- 增加需求 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="newRequirementModal">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">增加需求</h4>
            </div>
            <div class="modal-body">
                <form id="editCompanyForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-xs-4">
                            <label class="control-label label-required">需求项名称</label>
                            <div class="form-group">
                                <input name="demandName" id="demandName" type="text" class="form-control" placeholder="请输入需求项名称">
                            </div>
                        </div>
                        <div class="col-xs-12">
                            <label class="control-label label-required">需求内容</label>
                            <div class="form-group">
                                <textarea rows="8" name="demandContent" id="demandContent" class="form-control" maxlength="200"></textarea>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="saveDemand();">保存</button>
            </div>
        </div>
    </div>
</div>
<!-- 新增内训/添加内训需求 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="internalTrainingModal">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="internalTrainingTitle"></h4>
            </div>
            <div class="modal-body">
                <form id="internalTrainingForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-xs-4">
                            <label class="control-label label-required">公司规模</label>
                            <div class="form-group">
                                <input name="companySizeT" id="companySizeT" type="text" class="form-control" placeholder="请输入公司规模哦">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">需求负责人</label>
                            <div class="form-group">
                                <input name="demandLeaderT" id="demandLeaderT" type="text" class="form-control" placeholder="请输入需求负责人">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">公司财务人数</label>
                            <div class="form-group">
                                <input name="companyFinancialNumberT" id="companyFinancialNumberT" type="text" class="form-control" placeholder="请输入公司财务人数">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">需求负责人联系方式</label>
                            <div class="form-group">
                                <input type="text" hidden="hidden" id="phone">
                                <input name="contactInformationT" id="contactInformationT" type="text" class="form-control" placeholder="请输入需求负责人联系方式">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="saveTraining();">保存</button>
            </div>
        </div>
    </div>
</div>
<!-- 新增联系人 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addModel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">新增联系人</h4>
            </div>
            <div class="modal-body" style="min-height: 200px;">
                <form id="addContactForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-xs-4">
                            <label class="control-label label-required">联系人姓名</label>
                            <div class="form-group">
                                <input name="contactNameAdd" id="contactNameAdd" type="text" class="form-control" placeholder="请输入联系人姓名">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">联系方式</label>
                            <div class="form-group">
                                <input name="contactInformationAdd" maxlength="20" id="contactInformationAdd" type="text" class="form-control"
                                       placeholder="请输入联系方式">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label">在职情况</label>
                            <div class="form-group">
                                <select class="form-control" id="onTheJobSituationAdd" name="onTheJobSituationAdd" type="text" title="请选择">
                                    <option value="0">在职</option>
                                    <option value="1">离职</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">职务</label>
                            <div class="form-group">
                                <select name="contactPositionAdd" class="form-control" id="contactPositionAdd" type="text" title="请选择">
                                    <option value="0">公司管理</option>
                                    <option value="1">财务</option>
                                    <option value="2">人力</option>
                                    <option value="3">其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">联系人类型</label>
                            <div class="form-group">
                                <select name="contactState" class="form-control" id="contactState" type="text" title="请选择">
                                    <option value="1">主联系人</option>
                                    <option value="2">从联系人</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label">微信</label>
                            <div class="form-group">
                                <input name="wxAdd" type="text" id="wxAdd" class="form-control" placeholder="请输入微信">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label">邮箱</label>
                            <div class="form-group">
                                <input name="mailBoxAdd" id="mailBoxAdd" type="text" class="form-control"
                                       placeholder="请输入邮箱">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="saveTrainingContact();">保存</button>
            </div>
        </div>
    </div>
</div>
<!-- 修改联系人 -->
<div class="modal fade" tabindex="-1" role="dialog" id="editModel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">修改联系人</h4>
            </div>
            <div class="modal-body">
                <form id="edditContactForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-xs-6">
                            <label class="control-label">姓名</label>
                            <div class="form-group">
                                <input id="contactNameEdit" name="contactNameEdit" type="text" class="form-control" disabled="disabled">
                                <input id="trainingContactId" type="hidden">
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <label class="control-label">联系方式</label>
                            <div class="form-group">
                                <input maxlength="20" id="contactInformationEdit" name="contactInformationEdit" type="text" class="form-control" disabled="disabled">
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <label class="control-label">职务</label>
                            <div class="form-group">
                                <select name="contactPositionEdit" class="form-control" id="contactPositionEdit" type="text" title="请选择">
                                    <option value="0">公司管理</option>
                                    <option value="1">财务</option>
                                    <option value="2">人力</option>
                                    <option value="3">其他</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <label class="control-label">在职情况</label>
                            <div class="form-group">
                                <select name="onTheJobSituationEdit" class="form-control" id="onTheJobSituationEdit" type="text" title="请选择">
                                    <option value="0">在职</option>
                                    <option value="1">离职</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <label class="control-label">邮箱</label>
                            <div class="form-group">
                                <input name="mailBoxEdit" id="mailBoxEdit" type="text" class="form-control">
                            </div>
                        </div>
                        <div class="col-xs-6">
                            <label class="control-label">微信</label>
                            <div class="form-group">
                                <input name="wxEdit" id="wxEdit" type="text" class="form-control">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="updateTrainingContact();">确定</button>
            </div>
        </div>
    </div>
</div>
<!-- 新增需求分析 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addDemandAnalysisModel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">新增需求分析</h4>
            </div>
            <div class="modal-body">
                <form id="demandAnalysisForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-xs-4">
                            <label class="control-label label-required">需求分析名称</label>
                            <div class="form-group">
                                <input name="demandAnalysisName" id="demandAnalysisName" type="text" class="form-control" placeholder="请输入需求分析名称" maxlength="20">
                            </div>
                        </div>
                        <div class="col-xs-4">
                            <label class="control-label label-required">解决方案</label>
                            <div class="form-group">
                                <input name="solution" id="solution" type="text" class="form-control" placeholder="请输入解决方案" maxlength="60">
                            </div>
                        </div>

                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="saveDemandAnalysis();">确定</button>
            </div>
        </div>
    </div>
</div>
<!-- 新增竞品 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addCompetitorModel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">新增竞品</h4>
            </div>
            <div class="modal-body">
                <form id="competitorForm" autocomplete="off">
                    <div class="well form-well">
                        <h3>竞品信息</h3>
                        <div class="row">
                            <div class="col-xs-4">
                                <label class="control-label label-required">竞品名称</label>
                                <div class="form-group">
                                    <input name="competitorName" id="competitorName" type="text" class="form-control" placeholder="请输入竞品名称" maxlength="20">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label label-required">竞品价格</label>
                                <div class="form-group">
                                    <input name="competitorPrice" id="competitorPrice" type="text" class="form-control"
                                           placeholder="请输入竞品价格" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,4})?).*$/g, '$1')">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label label-required">竞品单位</label>
                                <div class="form-group">
                                    <input name="competitorUnit" maxlength="20" id="competitorUnit" type="text" class="form-control"
                                           placeholder="请输入竞品单位">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label label-required">竞品到期时间</label>
                                <div class="form-group">
                                    <input name="competitorDueTimej" id="competitorDueTimej" type="text" class="form-control" placeholder="请输入竞品到期时间">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="well form-well">
                        <h3>产品信息</h3>
                        <div class="row">
                            <div class="col-xs-4">
                                <label class="control-label label-required">产品名称</label>
                                <div class="form-group">
                                    <input name="productName" id="productName" type="text" class="form-control" placeholder="请输入产品名称" maxlength="20">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label label-required">产品价格</label>
                                <div class="form-group">
                                    <input name="productPrice" id="productPrice" type="text" class="form-control"
                                           placeholder="请输入产品价格" maxlength="20"  onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,4})?).*$/g, '$1')">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label">当前预算</label>
                                <div class="form-group">
                                    <input name="" id="currentBudget" type="text" class="form-control"
                                           placeholder="请输入当前预算" maxlength="20"  onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,4})?).*$/g, '$1')">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label">预算负责人</label>
                                <div class="form-group">
                                    <input name="" maxlength="10" id="budgetDirector" type="text" class="form-control"
                                           placeholder="请输入预算负责人">
                                </div>
                            </div>
                            <div class="col-xs-4">
                                <label class="control-label">负责人联系方式</label>
                                <div class="form-group">
                                    <input name="directorInformation" id="directorInformation" type="text" class="form-control"
                                           placeholder="请输入负责人联系方式" maxlength="11" onkeyup="value = value.replace(/[^\w\.\/]/ig,'')">
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="saveCompetitor();">确定</button>
            </div>
        </div>
    </div>
</div>
<!-- 产品详细信息 -->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="productInfo">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">产品详细信息</h4>
            </div>
            <div class="modal-body">
                <div class="well form-well">
                    <h3>会员卡信息</h3>
                    <div class="card-info clearfix" id="cardInfo">
                        <div class="code" id="cardCode"></div>
                        <div class="pull-left">
                            <h5>卡号：<span id="cardNum"></span></h5>
                            <p>密码：<span id="cardPassword">*********</span></p>
                            <p>有效期：<span id="cardDays">****.**.** 至 ****.**.**</span></p>
                        </div>
                        <div class="btn-box">
                            <p><span>暂无会员卡，请点击按钮申请会员卡</span></p>
                            <button type="button" class="btn btn-primary" id="applyCard">申请会员卡</button>
                        </div>
                    </div>
                </div>
                <div class="well form-well">
                    <h3>线上课程</h3>
                    <table id="onlineCourse"></table>
                </div>
                <div class="well form-well">
                    <h3>线下课程</h3>
                    <table id="offlineCourse"></table>
                </div>
                <div class="well form-well">
                    <h3>增值服务</h3>
                    <table id="valueAddedServices"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--修改商机-->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="updateOpportunityModel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-body" style="min-height: 200px;">
                <!-- start -->
                <h4 style="line-height: 40px;font-size: 14px;font-weight: bold;">修改商机</h4>
                <form class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商机标题</label>
                        <div class="col-sm-4">
                            <input id="opportunityTitleEdit" type="text" class="form-control" placeholder="请输入商机标题">
                            <input id="opportunityId" type="hidden">
                        </div>
                        <label class="col-sm-2 control-label">产品名称</label>
                        <div class="col-sm-4">
                            <select class="form-control" id="customerProductIdEdit" type="text" title="请选择"
                                    data-live-search="true">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商机主题</label>
                        <div class="col-sm-4">
                            <input maxlength="20" id="opportunityThemeEdit" type="text" class="form-control"
                                   placeholder="请输入商机主题">
                        </div>
                        <label class="col-sm-2 control-label">客户联系人</label>
                        <div class="col-sm-4">
                            <select class="form-control" id="contactIdEdit" type="text" title="请选择"
                                    data-live-search="true">
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">商机联系人</label>
                        <div class="col-sm-4 " style="display: flex;">
                            <input maxlength="20" id="opportunityContactEdit" type="text" class="form-control"
                                   placeholder="请输入商机联系人">
                        </div>
                        <label class="col-sm-2 control-label">商机状态</label>
                        <div class="col-sm-4">
                            <select class="form-control" id="opportunityStatusEdit" type="text" title="请选择商机状态"
                                    data-live-search="true">
                                <option value="1">初步洽谈</option>
                                <option value="2">需求确定</option>
                                <option value="3">方案报价</option>
                                <option value="4">谈判</option>
                                <option value="5">洽谈合同</option>
                                <option value="6">赢单</option>
                                <option value="7">输单</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">输单友商</label>
                        <div class="col-sm-4">
                            <input maxlength="20" id="lostOrderFriendEdit" type="text" class="form-control"
                                   placeholder="请输入输单友商">
                        </div>
                        <label class="col-sm-2 control-label">预计签单时间</label>
                        <div class="col-sm-4">
                            <input id="estimatedSigningTimeEdit" type="text"
                                   class="form-control date-inputSjEdit" placeholder="请选择预计签单时间">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">最后跟进时间</label>
                        <div class="col-sm-4">
                            <input id="lastFollowUpTimeEdit" type="text"
                                   class="form-control date-inputSjEdit" placeholder="请选择最后跟进时间">
                        </div>
                        <label class="col-sm-2 control-label">下次跟进时间</label>
                        <div class="col-sm-4">
                            <input id="nextFollowUpTimeEdit" type="text"
                                   class="form-control date-inputSjEdit" placeholder="请选择下次跟进时间">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">预计销售金额</label>
                        <div class="col-sm-4">
                            <input id="estimatedSalesAmountEdit" type="text" class="form-control"
                                   placeholder="请输入预计销售金额"
                                   onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,4})?).*$/g, '$1')">
                        </div>
                        <label class="col-sm-2 control-label">签单可能性</label>
                        <div class="col-sm-4">
                            <input id="possibilitySigningEdit" type="text" class="form-control"
                                   placeholder="请输入签单可能性">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商机类型</label>
                        <div class="col-sm-4">
                            <input  id="opportunityTypeEdit" type="text" class="form-control"
                                   placeholder="请输入商机类型">
                        </div>
                        <label class="col-sm-2 control-label">商机获取日期</label>
                        <div class="col-sm-4">
                            <input id="opportunityAcquisitionTimeEdit" type="text"
                                   class="form-control date-inputSjEdit">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">商机来源</label>
                        <div class="col-sm-4">
                            <input id="opportunitySourceEdit" type="text" class="form-control"
                                   placeholder="请输入商机来源">
                        </div>
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-4">
                            <input id="remarksEdit" type="text" class="form-control"
                                   placeholder="请输入备注">
                        </div>
                    </div>

                </form>
                <div style="width: 100%;display: flex;justify-content: center; margin-top: 30px;">
                    <div class="btn btn-primary" style="margin-right: 20px;" onclick="updateOpportunity()">确定</div>
                    <div class="btn btn-default" onclick="updateOpportunityHide()">取消</div>
                </div>
                <!-- end -->
            </div>
        </div>
    </div>
</div>

<!-- 新增兑换-->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addExchangeModel">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">新增兑换</h4>
            </div>
            <div class="modal-body">
                <form id="addExchangeForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-sm-12">
                            <div class="clearfix" style="margin-bottom: 10px">
                                <p class="pull-left" style="font-size:16px;font-weight: bold;">兑换前产品</p>
                                <div class="btn btn-primary pull-right">添加产品</div>
                            </div>
                            <table id="addBeforeExchange"></table>
                        </div>
                        <div class="col-sm-12">
                            <div class="clearfix"  style="margin-bottom: 10px">
                                <p class="pull-left" style="font-size:16px;font-weight: bold;">兑换后产品</p>
                                <div class="btn btn-primary pull-right">添加产品</div>
                            </div>
                            <table id="addAfterExchange"></table>
                        </div>
                        <div class="col-sm-12">
                            <div class="clearfix"  style="margin-bottom: 10px">
                                <p class="pull-left" style="font-size:16px;font-weight: bold;">增补金额</p>
                            </div>
                            <div class="form-group">
                                <div class="col-xs-4">
                                    <label class="control-label">增补金额</label>
                                    <div class="form-group">
                                        <input name="" id="" type="text" class="form-control"
                                               placeholder="请输入增补金额">
                                    </div>
                                </div>
                                <div class="col-xs-4">
                                    <label class="control-label">附加费用（不计入业绩金额）</label>
                                    <div class="form-group">
                                        <input name="" id="" type="text" class="form-control"
                                               placeholder="请输入附加费用">
                                    </div>
                                </div>
                                <div class="col-xs-4">
                                    <label class="control-label">应收金额</label>
                                    <div class="form-group">
                                        <input name="" id="" type="text" class="form-control"
                                               placeholder="请输入应收金额">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12">
                            <div class="clearfix"  style="margin-bottom: 10px">
                                <p class="pull-left" style="font-size:16px;font-weight: bold;">提交审批</p>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="">确定</button>
            </div>
        </div>
    </div>
</div>
<!--兑换详情-->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="addExchangeDetails">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">兑换详情</h4>
            </div>
            <div class="modal-body">
                <form id="addExchangeDetailForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-sm-12" style="margin-bottom: 20px">
                            <p class="pull-left" style="font-size:16px;font-weight: bold;width: 100%">兑换前产品</p>
                            <div>
                                <span style="width: 50%;display: inline-block">
                                    <span>111111</span>
                                </span>
                                <span>
                                    <span>111111111</span>
                                </span>
                            </div>
                        </div>
                        <div class="col-sm-12" style="margin-bottom: 20px">
                            <p class="pull-left" style="font-size:16px;font-weight: bold;width: 100%">兑换后产品</p>
                        </div>
                        <div class="col-sm-12" style="margin-bottom: 20px">
                            <p class="pull-left" style="font-size:16px;font-weight: bold;width: 100%">增补金额</p>
                        </div>
                        <div class="col-sm-12" style="margin-bottom: 20px">
                            <p class="pull-left" style="font-size:16px;font-weight: bold;width: 100%">审核人</p>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="">确定</button>
            </div>
        </div>
    </div>
</div>

<!--兑换详情-->
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="renewDetail">
    <div class="modal-dialog modal-lg" role="document" style="width: 70%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">新增续费</h4>
            </div>
            <div class="modal-body">
                <form id="renewDetailForm" class="well form-well" autocomplete="off">
                    <div class="row">
                        <div class="col-sm-12" id="table" style="margin-bottom: 20px;">
                            <table id="renewTable"></table>
                        </div>
                    </div>

                <div class="well form-well" >
                    <div class="row">
                        <div class="col-sm-12" style="margin-bottom: 20px">
                            <h3>附加费用</h3>
                            <div class="row">
                                <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
                                    <label class="control-label">金额</label>
                                    <div class="form-content">
                                        <input type="text" class="form-control" placeholder="该费用不计入业绩和提成" id="surcharge">
                                    </div>
                                </div>
                                <div class="form-group col-lg-12 col-md-12 col-sm-12 col-xs-12 surcharge-remarks">
                                    <label class="control-label label-required" for="orderSurchargeRemark">备注</label>
                                    <div class="form-content">
                                        <textarea class="form-control" rows="3" placeholder="不多于100字" id="orderSurchargeRemark" name="orderSurchargeRemark"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="well form-well">
                    <input type="text" id="productDiscountTotalInput" hidden>              <!--产品 总金额-->
                    <input type="text" id="productTotalInput" hidden>                      <!--产品 计价总计-->
                    <input type="text" id="examineType" value="0" hidden>                            <!--判定是否需要审核 1为审核-->

                    <h2>合同金额</h2>
                    <div class="row amount-total">
                        <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                            <div class="well">
                                <h5>合同总金额</h5>
                                <p id="totalAmount">0.00</p>
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                            <div class="well">
                                <h5>合同优惠总金额</h5>
                                <p id="discountAmount">0.00</p>
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                            <div class="well">
                                <h5>合同实际总金额</h5>
                                <p id="realAmount">0.00</p>
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6">
                            <div class="well">
                                <h5>应收款</h5>
                                <p id="receivables">0.00</p>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="well form-well">
                    <div class="row">
                        <div class="form-group col-lg-5 col-md-5 col-sm-6 col-xs-12 form-group">
                            <label class="control-label label-required" for="customerContractList">客户联系人</label>
                            <div class="form-content">
                                <select type="text" id="customerContractList" class="form-control" title="请选择客户联系人" data-live-search="true" disabled name="customerContractList"></select>
                            </div>
                        </div>
                        <div class="form-group col-lg-5 col-md-6 col-sm-6 col-xs-6">
                            <label class="control-label label-required" for="contractDate">合同起止日期</label>
                            <div class="form-content">
                                <input type="text" class="form-control" id="contractDate" name="contractDate" placeholder="请选择合同起止日期" autocomplete="off">
                            </div>
                        </div>
                        <div class="form-group col-lg-5 col-md-6 col-sm-6 col-xs-6">
                            <label class="control-label label-required" for="defray">支付方式</label>
                            <div class="form-content">
                                <select class="form-control" id="defray" title="请选择支付方式" type="text" name="defray">
                                    <option value="0">线下支付</option>
                                    <option value="1">余额支付</option>
                                    <option value="2">转入额支付</option>
                                    <option value="3">余额 + 转入额支付</option>
                                </select>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="well form-well">
                    <div class="row">
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">
                            <div class="file-group form-group">
                                <label class="control-label label-required" for="contractImg">合同附件</label>
                                <div class="file-box">
                                    <input type="hidden" id="contractPic" class="image-id" >
                                    <input type="file" accept=".doc,.pdf,.docx" id="contractImg" name="contractImg" class="form-control"  onchange="uploadImg('contractImg')">
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-lg-3 col-md-3 col-sm-3 col-xs-12 approval">
                            <div class="file-group">
                                <h5 class="label-required" for="examineImgBox">合同审核</h5>
                                <!--                            <input type="file" accaccept=".png,.jpg,.jpeg,.bmp,.gif,.docx,.doc" class="hidden" id="examineImg">-->
                                <!--                            <input type="hidden" id="examinedPic" class="image-id">-->
                                <!--                            <div class="img-box" id="examineImgBox"></div>-->
                                <!--                            <button class="btn btn-default file-browser" type="button">上传审核图片</button>-->
                                <div class="file-box">
                                    <input type="hidden" id="examinedPic" class="image-id">
                                    <input type="file" accept=".doc,.pdf,.docx" id="examineImgBox" name="examineImgBox" class="form-control"  onchange="uploadImg('examineImgBox')">
                                    <!--                                <input type="file" id="exfileToUpload" name="exfileToUpload" class="form-control"  onchange="fileSelected('exfileToUpload')" />-->

                                </div>
                            </div>
                        </div>
                        <div class="form-group col-lg-6 col-md-6 col-sm-6 col-xs-12 approval">
                            <h5 class="label-required" for="contractReviewNotes">审核备注</h5>
                            <textarea class="form-control" placeholder="请输入审核意见，不少于10个字" id="contractReviewNotes" name="contractReviewNotes"></textarea>
                        </div>
                    </div>
                </div>
                </form>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="renewSure()">确定</button>
            </div>
        </div>
    </div>
</div>

</body>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/bootstrapValidator.min.js"></script>
<script type="text/javascript" src="/js/perfect-scrollbar.min.js"></script>
<!--标签插件-->
<script src="/js/jquery-tags-input/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="/js/main.min.js"></script>
<script type="text/javascript" src="/js/bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="/js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/jquery.cookie.min.js"></script>
<script src="/js/jquery-confirm/jquery-confirm.min.js"></script>
<script src="/js/crm/common/city.js"></script>
<script src="/js/crm/common/common.js"></script>
<!--时间选择插件-->
<script src="/js/bootstrap-datetimepicker/moment.min.js"></script>
<script src="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
<!--标签插件-->
<script type="text/javascript" src="/js/bootstrap-tagsinput/bootstrap-tagsinput.js"></script>
<!--消息提醒-->
<script type="text/javascript" src="/js/bootstrap-notify.min.js"></script>
<script type="text/javascript" src="/js/crm/common/lightyear.js"></script>
<!--时间选择插件-->
<script src="/js/bootstrap-datetimepicker/moment.min.js"></script>
<script src="/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/js/bootstrap-datetimepicker/locale/zh-cn.js"></script>
<script type="text/javascript" src="/js/crm/common/dataRangePicker.min.js"></script>
<!-- 评分插件 -->
<script type="text/javascript" src="/js/crm/common/raty.js"></script>
<!--日期选择插件-->
<script src="/js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="/js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<!-- 多选框下拉 -->
<script type="text/javascript" src="/js/bootstrap-select.js"></script>
<script type="text/javascript" src="/js/bootstrap.lyear.dropdowntree.min.js"></script>
<script src="/js/crm/common/common.js"></script>
<script src="/js/crm/trainingManager/user/userTrainingDetail.js"></script>
</html>